import time

from Base import Base

from selenium.webdriver.common.by import By
class Page(Base):

    # 定位用户名
    username_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[1]/div/input')
    def username(self):
        self.send_keys(self.username_loc,'lisi')

    # 定位密码
    password_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[2]/div/input')
    def password(self):
        self.send_keys(self.password_loc,'123456')

    # 定位立即登录
    login_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/button[2]')
    def login(self):
        self.click(self.login_loc)


    # 点击确认登录
    sure_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[2]/div/div/div/div[2]/button[2]/span')
    def sure(self):
        self.click(self.sure_loc)

    # 登录的业务
    def test_login(self):
        # 获取网址的方法
        self.open_url('http://localhost:8081/xklogin')
        # 用户名
        self.username()
        time.sleep(3)
        # 密码
        self.password()
        time.sleep(3)
        # 立即登录
        self.login()
        time.sleep(3)
        # 点击确认登录
        self.sure()
        time.sleep(10)
















